
package com.probiz.estoresa.system.web.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;

import com.probiz.estore.core.controller.GenericStoreAdminController;
import com.probiz.estore.common.model.system.MailQueue;
import com.probiz.estore.system.service.MailQueueManager;

public class MailQueueController extends GenericStoreAdminController<MailQueue> {
	private MailQueueManager	mailQueueManager	= null;

	@Override
	public ModelAndView add(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	}

	@Override
	public ModelAndView edit(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.GenericController#getEntityName(java.lang.Object)
	 */
	@Override
	protected String getEntityName(MailQueue entity) {
		return entity.getMailSubject();
	}


	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.BaseController#initController()
	 */
	@Override
	protected void initController() throws Exception {
		mgr = mailQueueManager;
	}
	
	@Override
	protected Map<String,String> getSortMap(){
		Map<String,String> sortMap = new HashMap<String,String>();
		sortMap.put("1", "convert_gbk(mailSubject)");
		sortMap.put("2", "convert_gbk(mailFrom)");
		sortMap.put("3", "convert_gbk(mailTos)");
		sortMap.put("4", "sendStatus");
		sortMap.put("5", "sendTimes");
		return sortMap;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.GenericController#preSave(javax.servlet.http.HttpServletRequest,
	 *      java.lang.Object, org.springframework.validation.BindException)
	 */
	@Override
	protected void preSave(HttpServletRequest request, MailQueue entity,
			BindException errors) {
	}

	public void setMailQueueManager(MailQueueManager inMgr) {
		this.mailQueueManager = inMgr;
	}
}
